version: '3'
services:
    web:
        image: nginx
        restart: always
        ports:
            - 80:80
        volumes:
            - ./.docker/conf/nginx/default.conf:/etc/nginx/conf.d/default.conf
            - ./html:/var/www/html
        depends_on:
            - php
            - db

    php:
        build:
            context: .docker
            args:
                WWWUSER: 'laravel'
                WWWUID: '1000'
        restart: always
        volumes:
            - ./.docker/conf/php/php.ini:/usr/local/etc/php/conf.d/php.ini
            - ./.docker/conf/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
            - ./html:/var/www/html

    composer:
        image: composer
        volumes:
            - ./html:/app
        command: install

    db:
        image: postgres
        restart: always
        ports:
            - 5432:5432
        volumes:
            - ./.docker/conf/postgres/:/docker-entrypoint-initdb.d/
            - ./.docker/database/:/var/lib/postgresql/data
        environment:
            - POSTGRES_DB=${DB_DATABASE}
            - POSTGRES_USER=${DB_USERNAME}
            - POSTGRES_PASSWORD=${DB_PASSWORD}

    adminer:
        image: adminer
        restart: always
        ports:
            - 8080:8080

